
//bind the form with a jquery submit listener
$(document).ready(function(){
   $(".message_form").submit(function(e){
       e.preventDefault();
       var actionURL = $(this).attr("action");
       var postData=$(this).serialize();
       $.ajax({
           url:actionURL,
           dataType:"json",
           data:postData,
           method:'POST',
           success:function(data,success){
               if(success==="success"){
                   if(data.success){
                       // message has been send
                       alert(data.message);
                   }else{
                       // error while sending message
                       alert(data.message);
                   }
               }
           }
       });
       
   });
});

//after successful pop up a bootstrap modal to let user know that his message has been successfully sent

//when user click ok, send him to the home page




